<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>直播测试</title>
    <!-- Fonts -->
    <link rel="preconnect" href="https://fonts.bunny.net">
    <link href="https://fonts.bunny.net/css?family=figtree:400,600&display=swap" rel="stylesheet" />
</head>
<body class="antialiased">
<a id="open-app" href="yfapp://com.yunzhi.yangfan.ui.activity.WelcomeActivity">点击查看直播</a>

<script>
    document.getElementById('open-app').addEventListener('click', function(e) {
        e.preventDefault();
        let appLink = "yfapp://com.yunzhi.yangfan.ui.activity.WelcomeActivity";
        let downloadLink = "https://www.96189.com";

        // 尝试打开App
        window.location.href = appLink;

        // 500ms后未唤起则跳下载页
        setTimeout(function() {
            if (!document.webkitHidden && !document.hidden) {
                if (/android/i.test(navigator.userAgent)) {
                    window.location.href = "market://details?id=com.yourapp";
                } else if (/iphone|ipad|ios/i.test(navigator.userAgent)) {
                    window.location.href = "itms-apps://itunes.apple.com/app/id123456";
                }
            }
        }, 500);
    });
</script>
</body>
</html>
